﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
     xmlns:tc="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:me="clr-namespace:ScrumBoard"
    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"             
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Class="ScrumBoard.MasterView"             
    mc:Ignorable="d" FontFamily="{StaticResource DefaultFontFamily}" Foreground="#4b5657"
    d:DesignHeight="800" d:DesignWidth="1280" KeyDown="LayoutRoot_KeyDown">

  <tc:DockPanel x:Name="LayoutRoot" Background="{StaticResource MainBackground}" DataContext="{StaticResource MainVMSampleData}">
  	<VisualStateManager.CustomVisualStateManager>
  		<ei:ExtendedVisualStateManager/>
  	</VisualStateManager.CustomVisualStateManager>
  	<VisualStateManager.VisualStateGroups>
  		<VisualStateGroup x:Name="VisualStateGroup" ei:ExtendedVisualStateManager.UseFluidLayout="True">
  			<VisualStateGroup.Transitions>
  				<VisualTransition GeneratedDuration="0:0:0.3">
  					<VisualTransition.GeneratedEasingFunction>
  						<CircleEase EasingMode="EaseInOut"/>
  					</VisualTransition.GeneratedEasingFunction>
  				</VisualTransition>
  			</VisualStateGroup.Transitions>
  			<VisualState x:Name="Normal">
  				<Storyboard>
  					<DoubleAnimation To="1" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="Header" d:IsOptimized="True" Duration="0"/>
  					<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Header" d:IsOptimized="True"/>
  					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Header">
  						<DiscreteObjectKeyFrame KeyTime="0">
  							<DiscreteObjectKeyFrame.Value>
  								<Visibility>Visible</Visibility>
  							</DiscreteObjectKeyFrame.Value>
  						</DiscreteObjectKeyFrame>
  					</ObjectAnimationUsingKeyFrames>
  				</Storyboard>
  			</VisualState>
  			<VisualState x:Name="FullScreen">
  				<Storyboard>
  					<DoubleAnimation To="94" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationX)" Storyboard.TargetName="Header" d:IsOptimized="True" Duration="0"/>
  					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Header">
  						<DiscreteObjectKeyFrame KeyTime="0:0:3">
  							<DiscreteObjectKeyFrame.Value>
  								<Visibility>Collapsed</Visibility>
  							</DiscreteObjectKeyFrame.Value>
  						</DiscreteObjectKeyFrame>
  					</ObjectAnimationUsingKeyFrames>
  					<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Header">
  						<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
  						<EasingDoubleKeyFrame KeyTime="0:0:3" Value="1"/>
  					</DoubleAnimationUsingKeyFrames>
  				</Storyboard>
  			</VisualState>
  		</VisualStateGroup>
  	</VisualStateManager.VisualStateGroups>


    <Grid x:Name="Header" Margin="30,0" tc:DockPanel.Dock="Top">
    	<Grid.Projection>
    		<PlaneProjection RotationX="0" CenterOfRotationX="0" CenterOfRotationY="0"/>
    	</Grid.Projection>
      <Grid.RowDefinitions>
      	<RowDefinition Height="80" />
      	<RowDefinition Height="70" />
      </Grid.RowDefinitions>

    	<TextBlock Text="{Binding ProjectName}" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="{StaticResource DefaultFontFamily}" FontSize="30" FontWeight="Normal"
    		Foreground="{StaticResource ImportantForeground}" Cursor="Hand" >
    		<i:Interaction.Triggers>
    			<i:EventTrigger EventName="MouseLeftButtonDown">
    				<ei:GoToStateAction StateName="FullScreen"/>
    			</i:EventTrigger>
    		</i:Interaction.Triggers>
    	</TextBlock>
      
      <me:HeaderControl HorizontalAlignment="Right" VerticalAlignment="Center" />
      <Rectangle Height="1" Fill="{StaticResource ImportantForeground}" VerticalAlignment="Bottom" />

      <StackPanel x:Name="LinksStackPanel" Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Top" Margin="0,9,0,0">
        <HyperlinkButton Content="Board"  NavigateUri="/Board" Style="{StaticResource NavigationLinkStyle}" />
        <HyperlinkButton Content="Sprints"  NavigateUri="/TestPage" Style="{StaticResource NavigationLinkStyle}" />
        <HyperlinkButton Content="Backlog" Style="{StaticResource NavigationLinkStyle}" />
        <HyperlinkButton Content="Team Members" Style="{StaticResource NavigationLinkStyle}" />
      </StackPanel>
    	<Path IsHitTestVisible="False" Data="M0,0 L430,0 L0,70 z" HorizontalAlignment="Left" Margin="-30,0,0,10" Stretch="Fill" StrokeThickness="0" Width="430" UseLayoutRounding="False" >
    		<Path.Fill>
    			<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
    				<GradientStop Color="#44FFFFFF" Offset="0"/>
    				<GradientStop Color="#22FFFFFF" Offset="1"/>
    			</LinearGradientBrush>
    		</Path.Fill>
    	</Path>
    </Grid>

    <Grid>
    <navigation:Frame x:Name="ContentFrame"  Grid.Row="1" Margin="30,0"
                              Source="/Welcome" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed">
      <navigation:Frame.UriMapper>
        <uriMapper:UriMapper>
          <uriMapper:UriMapping Uri="" MappedUri="/Views/TestPage.xaml"/>
          <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
        </uriMapper:UriMapper>
      </navigation:Frame.UriMapper>
    </navigation:Frame>

    </Grid>
  </tc:DockPanel>
</UserControl>
